<?php

namespace app\index\controller;

use app\index\model\Comment as ModelComment;
use frame\lib\Db;
use frame\lib\VerfiyParam;

class Comment extends Base
{
    public function index()
    {
        $this->view('index');
    }
    public function list()
    {
        $comment = @$_GET['comment'];
        $list = ModelComment::list($comment);
        success($list);
    }
    public function del()
    {
        $id = @$_GET['id'];
        if (!$id) error('缺少参数ID', 201);
        $id = explode(',', $_GET['id']);
        $res = Db::name('comment')->where(['user_id'  => $this->uid])->whereIn('id', $id)->delete(true);
        if ($res) success();
        error();
    }
}
